<?php

class Car
{
  //member variable
  private $speed = 0;

  public function setSpeed($speed)
  {
    $this->speed = $speed;
  }

  public function getSpeed()
  {
    return $this->speed;
  }
  /*
   * If we didn't use $this keyword inside
   * definition of any function then that
   * function must be marked as static
   * because
   * that function is not related to class
   * On run time static method didn't use memory of
   * Object because it don't have any relation with object
   * */
  static function kmToMile($km=0)
  {
    return ($km/1.5);
  }

}

$swift = new Car;
$swift->setSpeed(150);
echo $speed = $swift->getSpeed();
echo "\n\n";
//echo $swift->kmToMile($speed);

//":: is scope resolution operator, which is used to call static function"
echo Car::kmToMile($speed);

/*
belong to
has one
has many

vikas "has many " bank accounts
bank account "belongs to" vikas

-------countries--------
id name
1  India
2  Pakistan
3  Nepal
------------------------
user "belong to" country (user contain ID of country)
country "has many" users (country don't need to take reference of user)
--------users-----------
id name    country_id
1  vikas   1
2  Hemant  1
3  Ravi    2
--------------------------
account "belong to" user (account contain ID of user)
user "has many" accounts(user don't need to take reference of accounts)
-------accounts--------------
id user_id bank_name
1  1       SBI
2  3       SBI
3  2       PNB
4  1       KOTAK
5  1       HSBC
----------------------------
*/







